package IO流;

import java.io.FileOutputStream;
import java.io.IOException;

public class 字节流写数据将异常处理 {
    public static void main(String[] args) {
        /*加入finally来实现释放资源*/
        FileOutputStream fos=null;
        try {
            fos=new FileOutputStream("D://111//222.txt");
            fos.write("hello".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(fos!=null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}